#ifndef ORDERITEMSECTIONMODEL_H
#define ORDERITEMSECTIONMODEL_H

#include "standard-database-model.h"

class OrderItemSectionModel : public StandardDatabaseModel
{
    Q_OBJECT
public:
    explicit OrderItemSectionModel(QObject *parent = 0);

    enum OrderItemSectionColumns
    {
        NameColumn,
        PriceColumn,
        VatColumn,
        QuantityColumn
    };

    ValueResult *canSetField(QVariant value, int column, int row);
    ValueResult *canSetRow(QVariantList dataList, int row);
    Qt::ItemFlags flags(const QModelIndex &index) const;

public slots:
    void initialize();
    void addData(QVariantList dataList);
    void updateData(QVariant data, int row, int column);

private slots:
    void setupInternalModel();
    void finishAddData(ValueResult *result);
    void finishUpdateData(ValueResult *result);
    void finishRemoveData(ValueResult *result);
    void updateOrderSum(bool dataLoaded);
    void continueUpdateOrderSum(ModelResult *result);
    void finishUpdateOrderSum(ValueResult *result);
};

#endif // ORDERITEMSECTIONMODEL_H
